package comviva.quicklyc;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		StringBuilder sb = new StringBuilder();
		String t;
		while ((t = br.readLine()) != null) {
			sb.append(t);
			t = null;
		}

		int delim = sb.indexOf("++++++++");

		String[][] data = getData(sb.substring(0, delim));
		List<String[]> pattern = getPattern(sb.substring(delim + 8));

		for (String[] d : data) {
			//String[] st = d;
			System.out.println("d = " + Arrays.toString(d));
			for (String[] pst : pattern) {
				boolean[] eval = new boolean[pst.length];
				Arrays.fill(eval, false);
				for(String p: pst)
					System.out.println("p = " + p);
				
				//String regex = "(\d+)\\:"
				
				
				
			}
		}
	}

	private static List<String[]> getPattern(String s) {
		List<String[]> li = new ArrayList<String[]>();

		String[] t = s.split(";");

		for (String st : t) {
			String[] x = st.trim().split("\\&");
			li.add(x);
		}

		return li;
	}

	private static String[][] getData(String s) {
		String[] t = s.split("\\|");

		int m = t.length;
		int n = t[0].split(",").length;

		String[][] data = new String[m][n];

		for (int i = 0; i < m; i++) {
			data[i] = t[i].split(",");
		}

		return data;
	}
}
